//
//  MainHomePageTopCustomView.swift
//  FrameProduct
//
//  Created by delegate on 2025/10/20.
//

import UIKit

class MainHomePageTopCustomView: UIView {
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
        
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    private func setupUI() {
        addSubviews(bgImageView)
        bgImageView.addSubviews(iconImageView, contentLabel)
        bgImageView.snp.makeConstraints { make in
            make.top.left.right.equalToSuperview()
            make.bottom.equalToSuperview()
        }
        iconImageView.snp.makeConstraints { make in
            make.top.equalTo(7)
            make.bottom.equalTo(-7)
            make.left.equalTo(20)
            make.width.height.equalTo(16)
        }
        contentLabel.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.height.equalTo(30)
            make.left.equalTo(iconImageView.snp.right).offset(5)
            make.right.equalTo(-20)
        }
    }
    //=================================================================
    //                            lazy
    //=================================================================
    // MARK: - lazy
    private lazy var bgImageView: UIImageView = {
        let imageView = UIImageView(frame: .zero)
        imageView.image = R.image.home_top_bg_img()
        imageView.isUserInteractionEnabled = true
        return imageView
    }()
    private lazy var iconImageView: UIImageView = {
        let imageView = UIImageView(frame: .zero)
        imageView.image = R.image.home_message_tip_icon()
        return imageView
    }()
    private lazy var contentLabel: MarqueeLabel = {
        let label = MarqueeLabel(frame: .zero)
        label.text = "如需帮助，请点击右上角“客服”图标（打不开客服网页的如需帮助，请点击右上角“客服”图标（打不开客服网页的如需帮助，请点击右上角“客服”图标（打不开客服网页的"
        label.textColor = .lxs.hex("#BFE0FF")
        label.font = .lxs.font(size: 12)
        label.speed = .duration(10.0)
        return label
    }()
}
